package com.aaa.mrcai.controller;

import com.aaa.mrcai.annotion.AAALog;
import com.aaa.mrcai.pojo.vo.MarketVO;
import com.aaa.mrcai.query.MarketQuery;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.MarketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:Li-Yan-Chun
 * @Date:2021/12/3 21:12
 */
@RestController
@RequestMapping("mar")
public class MarketController {
    @Autowired
    private MarketService marketService;

    @RequestMapping("list")
    public AjaxResult list(MarketQuery query){
        return marketService.list(query);
    }

    @RequestMapping("getMarket")
    public AjaxResult getMarket(){
        return marketService.getMarket();
    }

    @RequestMapping("getArea")
    public AjaxResult getArea(){
        return marketService.getArea();
    }

    @RequestMapping("getState")
    public AjaxResult getState(){
        return marketService.getState();
    }

    @RequestMapping("addMarket")
    @AAALog("添加市场")
    public AjaxResult addMarket(MarketVO marketVO){
        return marketService.addMarket(marketVO);
    }

    @RequestMapping("/getOneMarket/{id}")
    public AjaxResult getOneMarket(@PathVariable int id){
        return marketService.getOneMarket(id);
    }

    @RequestMapping("updateMarket")
    public AjaxResult updateMarket(MarketVO marketVO){
        return marketService.updateMarket(marketVO);
    }
}
